﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _3___StudentsLINQ
{
    class Program
    {
        static void Main(string[] args)
        {
            var students = new[] { 
                new { First = "Bobby", Second = "Ivanchev", Age = 21 },
                new { First = "Qni", Second = "Ivanchev", Age = 11 },
                new { First = "Vladi", Second = "Znkulov", Age = 23 } };

            var result =
                from student in students
                where  String.Compare(student.First, student.Second)<0
                select student;

            foreach (var item in result)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();
            Console.WriteLine();

            var result2 =
                from student in students
                where student.Age < 24 && student.Age>18
                select student;

            foreach (var item in result2)
            {
                Console.WriteLine("{0} {1}", item.First, item.Second);
            }
        }
    }
}
